{extend name="common/base"}
{block name="active"}class="active"{/block}
{block name="header"}
<body data-type="widgets">
{/block}
        <!-- 内容区域 -->
        {block name="message"}
        <style>
            .son{margin-left:30px};
            .sons{margin-left:30px};
        </style>
        <div class="tpl-content-wrapper">

            <div class="container-fluid am-cf">
                <div class="row">
                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-9">
                        <div class="page-header-heading"><span class="am-icon-home page-header-heading-icon"></span> 表单 <small>Amaze UI</small></div>
                        <p class="page-header-description">Amaze UI 有许多不同的表格可用。</p>
                    </div>
                    <div class="am-u-lg-3 tpl-index-settings-button">
                        <button type="button" class="page-header-button"><span class="am-icon-paint-brush"></span> 设置</button>
                    </div>
                </div>

            </div>

                <div class="row">

                    <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                        <div class="widget am-cf">
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">角色权限编辑</div>
                                <div class="widget-function am-fr">
                                    <a href="javascript:;" class="am-icon-cog"></a>
                                </div>
                            </div>
                            <div class="widget-body am-fr">

                                <form class="am-form tpl-form-border-form" action="{:url('store')}" method="post" enctype="multipart/form-data">
                                    {foreach name='permission' id="v"}
                                    <div class="row son2">
                                        <input type="checkbox" name="permission_id[]"value="{$v.id}" id="{$v.id}" {if condition="in_array($v.id , $role_permission_id)"}checked{/if}  >
                                        <label for="{$v.id}">{$v.personal_name}</label>     
                                        {if condition="isset($v['son'])"}

                                            
                                            <div class="row son">
                                                {foreach name="v['son']"" id="v2"}
                                                <input type="checkbox" name="permission_id[]" value="{$v2.id}" id="{$v2.id}" {if condition="in_array($v2.id , $role_permission_id)"}checked{/if}  >
                                                <label for="{$v2.id}">{$v2.personal_name}</label> 

                                                {if condition="isset($v2['son'])"}
                                                    <div class="sons">
                                                        {foreach name="v2['son']"" id="v3"}                                                        
                                                        <input type="checkbox" name="permission_id[]" value="{$v3.id}" id="{$v3.id}" {if condition="in_array($v3.id , $role_permission_id)"}checked{/if}  >
                                                        <label for="{$v3.id}">{$v3.personal_name}</label> 
                                                        {/foreach}                                             
                                                    </div>  
                                                {/if}  
                                                {/foreach}                                            
                                            </div>    
                                            
                                        {/if}                                                                       
                                    </div>
                                    {/foreach}
                                    <div class="am-form-group">
                                        <div class="am-u-sm-9 am-u-sm-push-3">
                                                <input type="hidden" name="role_id" value="{$Think.get.id}">
                                            <button type="submit" class="am-btn am-btn-primary tpl-btn-bg-color-success ">提交</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>


            </div>
        </div>
    </div>
    </div>
    {/block}
    {block name="script"}
    <script>
        $('input[name=src]').change(function(){
            var read=new FileReader;
            read.readAsDataURL(this.files[0]);
            read.onload=function(){
                $('#img').attr('src',this.result);
            }
        })
    </script>
    {/block}